#!/bin/sh
#llvm-gcc $1.c -emit-llvm -c -o $1.bc

opt -O3 $1.bc -f -o $1.opt

opt -mem2reg -indvars -loopsimplify $1.opt -f -o $1.opt

#opt -mem2reg $1.bc -f -o $1.opt

llvm-dis $1.opt -f -o $1.opt.ll

opt -load ~/llvm-2.6-build/Debug/lib/LLVMCS6241.so -phase1 $1.opt -f -o $1.fuck

llvm-dis $1.fuck -f -o $1.fuck.ll

# link with Thread Tailor
llvm-ld -o $1_check $1.fuck check.bc 

#lli $1_check.bc $2
